﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Web.Management;

namespace OpenLightGroup.Common.ApplicationServices
{

    public abstract class ClientEvent : WebBaseEvent
    {
        internal ClientEvent(string message, object eventSource, int eventCode, int eventDetailCode, EventLogRequest request)
            : base(message, eventSource, eventCode, eventDetailCode)
        {
            this.EventLogRequest = request ;
        }

        protected internal ClientEvent(string message, object eventSource, int eventCode)
            : base(message, eventSource, eventCode)
        {
            
        }
        protected internal ClientEvent(string message, object eventSource, int eventCode, int eventDetailCode)
            : base(message, eventSource, eventCode, eventDetailCode)
        {

        }

        public EventLogRequest EventLogRequest { get ;  set ;  }

        public override void FormatCustomEventDetails(WebEventFormatter formatter)
        {
            base.FormatCustomEventDetails(formatter);

            formatter.AppendLine ( "Client Event Details:" ) ;
            formatter.AppendLine ( this.EventLogRequest.ClientDetails ) ;            

        }
    }

    //[DataContract]
    //public class ClientEvent1
    //{
    //    public ClientEvent1()
    //    {
            
    //    }
        
    //    [DataMember]
    //    public DateTime EventTime { get; set; }

    //    [DataMember]
    //    public string Message { get; set; }
        
    //    [DataMember]
    //    public int EventDetailCode { get; set; }
        
    //    [DataMember]
    //    public object EventSource { get; set; }

    //    [DataMember]
    //    public ClientEventTypes EventType { get; set; }
    //}

    //public enum ClientEventTypes
    //{
    //    Debug,
    //    Information,
    //    Warning,
    //    Error,
    //    CriticalError
    //}
}
